package com.paas.form.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.paas.common.util.StringUtil;
import org.springframework.stereotype.Service;

import com.paas.form.dao.FormViewChangeInfoDetailDao;
import com.paas.form.entity.FormViewChangeInfoDetailEntity;
import com.paas.form.service.IFormViewChangeInfoDetailService;
import com.paas.common.web.service.BaseServiceImpl;

import java.util.List;

@Service("formViewChangeInfoDetailService")
public class FormViewChangeInfoDetailServiceImpl  extends BaseServiceImpl<FormViewChangeInfoDetailDao,FormViewChangeInfoDetailEntity> implements IFormViewChangeInfoDetailService{


    /**
     * 根据主表删除明细表数据
     * @param changeInfoId
     */
    @Override
    public void deleteByChangeId(String changeInfoId){
        if(StringUtil.isNotEmpty(changeInfoId)){
            //定义查询构建器
            QueryWrapper<FormViewChangeInfoDetailEntity> queryWrapper = new QueryWrapper<FormViewChangeInfoDetailEntity>();
            queryWrapper.eq("change_info_id",changeInfoId);
            this.baseMapper.delete(queryWrapper);
        }
    }

    /**
     * 根据变更主键id,查询变更明细集合
     * @param changeInfoId
     * @return
     */
    @Override
    public List<FormViewChangeInfoDetailEntity> getListByChangeId(String changeInfoId){
        if(StringUtil.isNotEmpty(changeInfoId)){
            //定义查询构建器
            QueryWrapper<FormViewChangeInfoDetailEntity> queryWrapper = new QueryWrapper<FormViewChangeInfoDetailEntity>();
            queryWrapper.eq("change_info_id",changeInfoId);
            return this.baseMapper.selectList(queryWrapper);
        }
        return null;
    }

}